package com.zjgk.hotel.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.text.SimpleDateFormat;

@AllArgsConstructor
@NoArgsConstructor
@Data
public class Result{
    /**
     * 200  接收或传递数据成功
     * 4000 接收或传递数据失败
     * 4004 没有对应数据
     * 4005 网络异常
     * 500 服务器异常
     */
    public static final int SUCCESS = 200;
    public static final int SERVER_ERROR = 500;
    public static final int TRANSMIT_ERROR = 4000;
    public static final int NOT_LOGGED = 502;
    public static final int NETWORK_ERROR = 4005;
    public static final int NO_CORRESPONDING_DATA = 4004;


    int code;
    String msg;
    Object data;
    public String switchTime(Long time){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        return sdf.format(time);// 格式化时间

    }

    public Result(int code, String msg) {
        this(code, msg, null);
    }
}
